-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KNOX-3065: SSE support for Knox #947
Conversation
Hi @hanicz ! Could you please elaborate on the tests you executed with a custom SSE service? Future readers will benefit from it if they want to configure such an environment. |
Agreed, thanks for chiming in @smolnar82! |
Fixed the JLS issue in a new commit and added my local test setup to my initial comment. |
The test fail is unrelated to my change. The cause seems to be this PR |
a7e881a
to
0f1457f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly some nit-picking about method names. Otherwise, it looks like a good addition.
gateway-spi/src/main/java/org/apache/knox/gateway/SpiGatewayMessages.java
Outdated
Show resolved
Hide resolved
gateway-spi/src/main/java/org/apache/knox/gateway/dispatch/GatewayDispatchFilter.java
Show resolved
Hide resolved
gateway-spi/src/main/java/org/apache/knox/gateway/sse/SSEDispatch.java
Outdated
Show resolved
Hide resolved
gateway-spi/src/main/java/org/apache/knox/gateway/sse/SSEDispatch.java
Outdated
Show resolved
Hide resolved
gateway-spi/src/main/java/org/apache/knox/gateway/sse/SSEDispatch.java
Outdated
Show resolved
Hide resolved
gateway-spi/src/main/java/org/apache/knox/gateway/sse/SSEEntity.java
Outdated
Show resolved
Hide resolved
gateway-spi/src/main/java/org/apache/knox/gateway/sse/SSEEntity.java
Outdated
Show resolved
Hide resolved
0d1cb55
to
0106780
Compare
gateway-spi/src/main/java/org/apache/knox/gateway/SpiGatewayMessages.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more log message concern.
gateway-spi/src/main/java/org/apache/knox/gateway/SpiGatewayMessages.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. thank you @hanicz !
What changes were proposed in this pull request?
SSE support for Knox.
Currently Knox is not working with SSE. In case of SSE the response header contains Content-Type = text/event-stream, in which case the server will send messages terminated by \n\n. Knox should send these messages to the client as they arrive. Currently Knox collects them all, and once the server closes the connection sends all of them concatenated to each other to the client.
Requirement:
Full support in Knox for Server Sent Events.
Definition of done:
Clients can connect to SSE endpoints in the backend via Knox.
Server Sent Events (https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events) are forwarded by Knox from the server to the client as soon as they are received.
How was this patch tested?
Unit tests.
Locally tested with a custom SSE service.
Any SSE service that is the follows the specs is supported in Knox.
Setup:
Asynchronous behaviour and therefore SSE support is not enabled by default. Modify the below config to ‘true’ in /conf/gateway-site.xml file.
Change the existing topology by adding an SSE service to /conf/{topology}.xml
Add the SSE service to the <KNOX_HOME>/data/services folder.
/data/services/{myservice}/{version}/rewrite.xml
/data/services/{myservice}/{version}/service.xml (Make sure to add the SSEDispatch to the service)
curl command to test the configured SSE service:
curl -k -i -u admin:admin-password https://localhost:8443/gateway/sandbox/sservice/sse
GET, POST, PUT, PATCH methods were tested.